box gadget: Don't allow shifting too far
authorMatthias Clasen <mclasen@redhat.com>
Sat, 23 Jan 2016 03:49:01 +0000 (22:49 -0500)
committerMatthias Clasen <mclasen@redhat.com>
Sat, 23 Jan 2016 03:49:01 +0000 (22:49 -0500)
We don't want to let baseline adjustment shift the child
out of the original allocation. This is purely a sanity
measure - in practice, the baseline should always be bigger
than the child_baseline.

gtk/gtkboxgadget.c

index cf9cb7314a2c0011bec82e749f7ad7d80ab7a5f3..ea18a21c28d52094a9a643fbe248c874756faa8d 100644 (file)
@@ -314,7 +314,7 @@ gtk_box_gadget_allocate_child (GObject        *child,
               if (minimum_baseline >= 0 && baseline >= 0)
                 {
                   child_allocation.height = MIN(natural, allocation->height);
-                  child_allocation.y = allocation->y + baseline - minimum_baseline;
+                  child_allocation.y = allocation->y + MAX(0, baseline - minimum_baseline);
                   break;
                 }
             case GTK_ALIGN_CENTER: